

comments_ctr = 0;
function assignCommentsComponent(domElementName){
	try{
	YAHOO.util.Dom.insertAfter ( "commentsComponent" , domElementName) ;
	dwr.util.removeAllRows("comments_tbody", {
		filter : function(tr) {
			return (tr.id != "comments_pattern");
		}
	});
	pocomments_ctr = 0;
	var dtt = new Date();
	var ts = dtt.getTime() +  "";
	dwr.util.setValue('target_comp_comment_id',ts);
	document.getElementById('commentsComponent').style.display='block';
	}catch(ex){console.log(ex)};
}


function add_comment(){
	var text = dwr.util.getValue('commenttextarea');
	text = usrname+" : "+text;
	if(isEmptyString(text)){
		showusrmessage("Nothing to add from the Comments Text Area.");
		return;
	}
	var ids = comments_ctr + "";
	
	dwr.util.cloneNode('comments_pattern', {
		idSuffix : ids
	});
	
	dwr.util.setValue("comment_text"+ids,text);
	pocomments_ctr++;
	document.getElementById("comments_pattern"+ids).style.display = '';
	dwr.util.setValue('commenttextarea',"");
}

function displayPrevComments(domElementName,comments){
	for(var i =0;i<comments.length;i++){
		
		var commentObj = comments[i];
		
		var sHTML = "<input checked type='checkbox' disabled>&nbsp;&nbsp;<span class='lable'>"+commentObj+"</span>"
		
		jQuery('#'+domElementName).append(sHTML);
		
		
	}
}